<?php

define('DOC_ROOT_PATH', rtrim(dirname(dirname(dirname(dirname(dirname(__FILE__))))), '/\\') . DIRECTORY_SEPARATOR);
define('APPATH', str_replace('./', '', APP_PATH));

class UcService{

    public function __construct() {

        include_once(DOC_ROOT_PATH . 'config.inc.php');
        
        include_once(DOC_ROOT_PATH . 'uc_client/client.php');
    }

//用户注册 这个方法是UcService.class.php的

    public function register($username, $password, $email) {
        $uid = uc_user_register($username, $password, $email);
        if ($uid <= 0) {
            if ($uid == -1) {
                return '用户名不合法';
            } elseif ($uid == -2) {
                return '包含不允许注册的词语';
            } elseif ($uid == -3) {
                return '用户名已经存在';
            } elseif ($uid == -4) {
                return 'Email 格式有误';
            } elseif ($uid == -5) {
                return 'Email 不允许注册';
            } elseif ($uid == -6) {
                return '该Email 已经被注册';
            } else {
                return '未定义';
            }
        } else {
            return intval($uid);
        }
    }
}

    